package icasue.tools.sqlhelper.core;

import icasue.reflect.annotations.Nullable;
import icasue.reflect.handles.predicate.SureOF;
import icasue.tools.sqlhelper.core.SQLSplit;
import icasue.tools.sqlhelper.common.Const;
import icasue.reflect.annotations.NotNull;

/**
 * @Author: Qiao Hang
 * @CreateDate: 2021/10/14 下午3:29
 * @UpdateDate:
 * @Description:
 */
class Condition {
    public @NotNull String jField;
    public @Nullable Object[] values;
    public @NotNull
    SQLSplit.SplitOP operate;
    public @NotNull String logicRelationship;

    protected Condition(String logic_relationship){
        if(logic_relationship == null || logic_relationship.equals(Const.AND) || logic_relationship.equals(Const.OR)){
            this.logicRelationship = logic_relationship;
        }else {
            SureOF.isNull("No", "query Condition's logic relationship must in range of [null, and, or]");
        }
    }

    protected Condition(@NotNull SQLSplit.SplitOP operate, @NotNull String jField, @Nullable Object... values){
        this.operate = operate;
        this.jField = jField;
        this.values = values;
    }

}
